// 随机打乱数组

// 多维数组
const source = [1, 2, 3, 4, 5, 6, 7, 8, [7, 6, 563, 4, 5], [2, 3, 4, [3, 4, 5, 7], 6, [5, 4, 6, 7, 8]]];
const flat = function (arr) {
  // console.log('------');
  return [].concat(...arr.map(v => Array.isArray(v) ? flat(v) : v));
};
const res = flat(source);
console.log('res', res);
